extends Camera2D
var strength := 0.0
@export var recovery_speed := 16.0

func _ready() -> void:
	Game.camera_should_shake.connect(_shake_carame)

func _process(delta: float) -> void:
	if strength != 0:
		offset = Vector2(
			randf_range(-strength, strength),
			randf_range(-strength, strength)
		)
		strength = move_toward(strength, 0, recovery_speed * delta)
	
func _shake_carame(amount : float) ->void:
	strength += amount
